function problem_2()
%问题二
for i=1:1000
t=randperm(24,1);
N=randperm(50,1);
[empty,wait,flag] = judge(t,N);
ret_emp(i)=empty;
ret_wait(i)=wait;
ret_flag(i)=flag;
end

difference=ret_wait-ret_emp;

figure(1)
plot(ret_flag,'b');
ylim([-1,2]);
title("司机选择情况")
legend("选择");

figure(2)
hold on
plot(ret_wait);
plot(ret_emp);
title("收益")
legend("空载返回收益","等待收益");

figure(3)
plot(difference,'c');
title("等待收益与返回收益差值")
legend("差值");


%可靠性分析

for j=1:100
    t=randperm(24,1);
    [empty,wait,flag] = judge(t,j);
    test_flag(j)=flag;
    test_empty(j)=empty;
    test_wait(j)=wait;
end
cftool();
figure(4)
x=(1:100);
plot(x,test_wait);
title("蓄车池候车数量与返回收益关系");
end

